/**
 * @(#) WxReceiveMessageServiceImpl.java    2015/07/14 11:06
 *
 * 版权所有 (c) 山东远洋网络科技有限公司
 * 保留所有权利
 */
package com.banksoft.admin.service.impl;

import com.banksoft.admin.SystemCache;
import com.banksoft.admin.bean.*;
import com.banksoft.admin.dao.BaseMyBatisDao;
import com.banksoft.admin.dao.UserDao;
import com.banksoft.admin.dao.UserMoneyDao;
import com.banksoft.admin.entity.User;
import com.banksoft.admin.entity.UserMoney;
import com.banksoft.admin.service.WxReceiveMessageService;
import com.banksoft.common.ConfigHelper;
import com.banksoft.front.bean.MessageUtil;
import com.banksoft.front.bean.WeiXinUser;
import com.banksoft.front.bean.WxEventType;
import com.banksoft.front.util.SignUtil;
import com.banksoft.front.util.WxSupportUtil;
import com.banksoft.util.MD5Util;
import com.banksoft.util.StringUtil;
import com.banksoft.util.UUIDFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;

/**
 * 类的功能，目的，描述等写在此处
 *
 * @author 张战军
 * @version 1.0
 */
@Service
public class WxReceiveMessageServiceImpl  implements WxReceiveMessageService {

    @Autowired
    UserDao userDao;
    @Autowired
    BaseMyBatisDao baseMyBatisDao;
    @Autowired
    UserMoneyDao userMoneyDao;


    /**
     * 绑定服务器URL 或者接受微信公众账号会员发送的消息内容，然后根据不同设置
     * 给对方回复消息
     * @param token  店铺shopId
     * @throws Exception
     */
    @Override
    public void receive(HttpServletRequest request,HttpServletResponse response,String token) throws Exception {
        String type = request.getMethod();
        System.out.println("*************  "+type);
        if ("GET".equals(type)) {
            doGet(request, response, token);
        } else if ("POST".equals(type)) {
            doPost(response, request);
        }
    }

    private void doGet(HttpServletRequest request, HttpServletResponse response, String token) throws IOException {
        // 微信加密签名
        String signature = request.getParameter("signature");
        // 时间戳
        String timestamp = request.getParameter("timestamp");
        // 随机数
        String nonce = request.getParameter("nonce");
        // 随机字符串
        String echostr = request.getParameter("echostr");
        System.out.println("签名："+signature);
        System.out.println("时间戳："+timestamp);
        System.out.println("随机数："+nonce);
        System.out.println("随机字符串："+echostr);
        System.out.println("token："+token);
        PrintWriter out = response.getWriter();
        // 通过检验signature对请求进行校验，若校验成功则原样返回echostr，表示接入成功，否则接入失败
        if (SignUtil.checkSignature(signature, timestamp, nonce, token)) {
            out.print(echostr);
        }
        out.close();
        out = null;
    }

    private void doPost(HttpServletResponse response, HttpServletRequest request) throws Exception{
        // 将请求、响应的编码均设置为UTF-8（防止中文乱码）
        request.setCharacterEncoding("UTF-8");
        response.setCharacterEncoding("UTF-8");

        WxSetting wxSetting = SystemCache.getWxSetting();

        // 调用核心业务类接收消息、处理消息
        List<String> respMessage = processRequest(request, wxSetting);

        //如果回复信息为空则不进行回复
        if (!StringUtil.isNotEmpty(respMessage)) {
            return;
        }
        // 响应消息
       /* PrintWriter out = response.getWriter();
        for(String content:respMessage)
            out.println(content);
        out.flush();
        out.close();*/


    }


    //组装群发消息时的文本消息
    private String createTextMessage(String openId, String content) {
        String mes = "{\n" +
                "    \"touser\":\""+openId+"\",\n" +
                "    \"msgtype\":\"text\",\n" +
                "    \"text\":\n" +
                "    {\n" +
                "         \"content\":\""+content+"\"\n" +
                "    }\n" +
                "}";
        return mes;
    }

    // 调用核心业务类接收消息、处理消息
    private List<String> processRequest(HttpServletRequest request, WxSetting weiXinSetting) {
        List<String> respMessage = new ArrayList<>();
        try {
            // 默认返回的文本消息内容
           List<String> respContent = new ArrayList<>();
            // xml请求解析
            Map<String, String> requestMap = MessageUtil.parseXml(request);
            System.out.println("++++++++   "+requestMap);
            // 发送方帐号（open_id）
            String fromUserName = requestMap.get("FromUserName");
            // 公众帐号
            String toUserName = requestMap.get("ToUserName");
            // 消息类型
            String msgType = requestMap.get("MsgType");
            // 事件类型
            String eventType = requestMap.get("Event");
            //EventKey
            String eventKey = requestMap.get("EventKey");

            // 回复文本消息
            TextMessage textMessage = new TextMessage();
            textMessage.setToUserName(fromUserName);
            textMessage.setFromUserName(toUserName);
            textMessage.setCreateTime(System.currentTimeMillis());
            textMessage.setMsgType(WxMesType.text.name());
            textMessage.setFuncFlag(0);


            if (WxMesType.text.name().equals(msgType)) {//如果是文本消息
               /* String content = requestMap.get("Content");//收到的文本消息
                //判断关键字表中是否拥有收到的文本消息，如果有责把关键词对应的内容发给你对方，如果没有则发送准备好的内容
                KeywordReply keywordReply = createContentByKeyword(keywordReplyList, content);
                if (keywordReply == null) {
                    mrNoPpReply(weiXinSetting, respContent, textMessage);
                } else if (keywordReply != null) {
                    textMsgTypeHf(textMessage, respContent, keywordReply, weiXinSetting, shopId, keywordReplyList);
                }*/
            } else if (WxMesType.event.name().equals(msgType)) {//如果是事件推送
                //如果是事件推送 自定义菜单点击事件
                if (WxEventType.CLICK.name().equals(eventType)) {
                    //根据点击按钮的key值来查找对应的内容
                    /*createContentByKey(eventKey, textMessage, shopId, respContent);
                    if (StringUtil.isNullOrEmpty(respContent.toString())) {
                        mrNoPpReply(weiXinSetting, keywordReplyList, shopId, respContent, textMessage);
                    }*/
                } else if (WxEventType.subscribe.name().equals(eventType)) {//关注
                    System.out.println("关注事件");
                   // textMsgTypeHfSubscribe(weiXinSetting, respContent, textMessage);//关注回复
                    System.out.println("判断用户是否扫描二维码进行关注的");
                    //用户扫描二维码时 如果已经关注或者未关注时点击关注的时候会触发该方法，把二维码带的参数以及扫描二维码的会员openId保存起来
                    respContent = createWxOpenId(eventType, eventKey, fromUserName);
                } else if (WxEventType.unsubscribe.name().equals(eventType)) {//取消关注
                    //根据取消关注者的openId，删除对应用户表中的信息
                   // wxCustomerSupportService.deleteByOpenId(fromUserName, shopId);
                }  else if(WxEventType.SCAN.name().equals(eventType)) {//用户已关注时的事件推送
                    //用户扫描二维码时 如果已经关注或者未关注时点击关注的时候会触发该方法，把二维码带的参数以及扫描二维码的会员openId保存起来
                    respContent = createWxOpenId(eventType, eventKey, fromUserName);
                }
            }

            if (WxMesType.text.name().equals(textMessage.getMsgType())) {//文本类型消息
                if (!StringUtil.isNotEmpty(respContent)) {//如果是回复内容为空 则直接返回null
                    return null;
                }
                /*String content = "";
                for(String str:respContent){
                  content+= str+"\r\n";
                }
                textMessage.setContent(content);
                String message = MessageUtil.textMessageToXml(textMessage);
                respMessage.add(message);*/
                for(String message:respContent){
                    WxSupportUtil.kfSendMessage(SystemCache.getWxSetting(),createTextMessage(fromUserName,message));
                }

                System.out.println("返回s消息："+respMessage);
            } else if (WxMesType.image.name().equals(textMessage.getMsgType())) {  //图片类型消息
               // respMessage = MessageUtil.imageMessageToXml(textMessage);
            } else if (WxMesType.news.name().equals(textMessage.getMsgType())) {//图文消息类型
                //respMessage = MessageUtil.imageTextMessageToXml(textMessage);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return respMessage;
    }

    //用户扫描二维码时 如果已经关注或者未关注时点击关注的时候会触发该方法，把二维码带的参数以及扫描二维码的会员openId保存起来
    private List<String>  createWxOpenId(String eventType, String eventKey, String openId) {
        List<String> list = new ArrayList<>();
        System.out.println(eventType+"扫描二维码是：eventKey=" + eventKey);
        if(StringUtil.isNullOrEmpty(eventKey)) {
            return null;
        }
        System.out.println("----   "+openId);

        String recommendId = null;
        if(WxEventType.subscribe.name().equals(eventType)) {
            System.out.println("subscribe==eventKey" + eventKey);
            recommendId = eventKey.substring("qrscene_".length(), eventKey.length());
        } else if(WxEventType.SCAN.name().equals(eventType)) {
            System.out.println("scan==eventKey" + eventKey);
            //if(eventKey.indexOf("qrscene_")>-1)
                recommendId = eventKey ;//.substring("qrscene_".length(), eventKey.length());
        }
        System.out.println("扫描二维码时recommendId=" + recommendId);
       /* if(StringUtil.isNullOrEmpty(recommendId)) {
            return null;
        }*/

        User upuser = this.baseMyBatisDao.findById(UserDao.class,recommendId);

        User user = this.userDao.findByOpenId(openId);
        if(user!=null){
            if("1".equals(user.getIsMember())){
                list.add("您已经是荩美国际会员");
                User upuser1 = this.baseMyBatisDao.findById(UserDao.class,user.getRecommendId());
                if(upuser1!=null)
                    list.add("您的上级是："+upuser1.getNickName());
                String message =  " /:hug /:hug \n <a href='http://www.boaishangcheng.com/wx/index'>点击进入商城</a>";
                list.add(message);
            }else{
                if(StringUtil.isNotNull(recommendId)) {
                    if (!recommendId.equals(user.getId())) {
                        if (user.getLastLoginTime() != null) {//如果记录了上次登录进入时间
                            long now = new Date().getTime();
                            if (((now - user.getLastLoginTime()) / (24 * 60 * 60 * 1000)) > 2) {//超过3天
                                user.setRecommendId(recommendId);
                                user.setLastLoginTime(new Date().getTime());
                            } else {
                                if (!StringUtil.isNotNull(user.getRecommendId())) {
                                    user.setRecommendId(recommendId);
                                    user.setLastLoginTime(new Date().getTime());
                                }
                            }
                        }else {//没有记录上次登录时间的话 更新推荐人
                            user.setRecommendId(recommendId);
                            user.setLastLoginTime(new Date().getTime());
                        }
                        this.baseMyBatisDao.update(UserDao.class,user);
                    }
                }
                if(upuser!=null){
                    list.add("扫描了 "+upuser.getNickName());
                    list.add("你的上级为："+upuser.getNickName());
                }
                String message =  "/:hug /:hug \n <a href='http://www.boaishangcheng.com/wx/index'>点击进入商城</a>";
                list.add(message);
            }
        }else{
            if(upuser!=null){
                list.add("扫描了 "+upuser.getNickName());
                list.add("你的上级为："+upuser.getNickName());
            }
            try {
                WeiXinUser  weiXinUser = WxSupportUtil.getWeiXinUser(openId, SystemCache.getWxSetting());
                if(weiXinUser!=null){
                    user = saveUser(user,weiXinUser,openId,recommendId);
                    List<User> userlist = this.userDao.listAll();
                    //this.userDao.list(new HashMap());
                    String message = "/:heart /:heart 终于等到你！\n 亲爱的"+user.getNickName()+"\n  恭喜你成为荩美佳第【"+(5000+userlist.size())+"】位会员。\n " +
                            " /:hug /:hug \n <a href='http://www.boaishangcheng.com/wx/index'>点击进入商城</a>";

                    list.add(message);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        /*else{
            if(!("1".equals(user.getIsMember()))&&!user.getId().equals(recommendId)){//不是通过扫描本人的id进入的
                if(user.getLastLoginTime()!=null){//如果记录了上次登录进入时间
                    long now = new Date().getTime();
                    if(((now - user.getLastLoginTime())/(24*60*60*1000))>2){//超过3天
                        user.setRecommendId(recommendId);
                        user.setLastLoginTime(new Date().getTime());
                    }else{
                        if(!StringUtil.isNotNull(user.getRecommendId())) {
                            user.setRecommendId(recommendId);
                            user.setLastLoginTime(new Date().getTime());
                        }
                    }
                }else{//没有记录上次登录时间的话 更新推荐人
                    user.setRecommendId(recommendId);
                    user.setLastLoginTime(new Date().getTime());
                }
            }
            this.baseMyBatisDao.update(UserDao.class,user);
        }*/
        System.out.println("消息："+list);
        if(user==null)
            return null;

        return list;
    }

    /**
     * 保存用户信息
     * @param user
     * @param weiXinUser
     * @param openId
     * @param recommendId
     */
    private User saveUser(User user,WeiXinUser weiXinUser,String openId,String recommendId) {
        user = new User();
        user.setId(UUIDFactory.random());
        user.setCity(weiXinUser.getCity());
        user.setPassword(MD5Util.getMD5ofStr(ConfigHelper.GetInstance().GetConfig("Init_Pwd")));
        user.setAccount(getMemberAccount());
        user.setOpenId(openId);
        user.setNickName(weiXinUser.getNickname());
        user.setIsShare(Enable.No.name());
        user.setSex(weiXinUser.getSex());
        user.setCountry(weiXinUser.getCountry());
        user.setProvince(weiXinUser.getProvince());
        user.setHeadimgUrl(weiXinUser.getHeadimgurl());
        user.setIsMember("0");//非正式会员
        user.setRecommendId(recommendId);
        user.setType(MemberType.Customer.name());
        user.setStatus(Status.NORMAL.name());
        user.setCreateTime(new Date().getTime());
        user.setLastLoginTime(new Date().getTime());
        try {
            baseMyBatisDao.insert(UserDao.class,user);
        }catch (Exception e){//此处有可能你成保存时出现错误
            user.setNickName("");//出现错误时 不保存昵称
            baseMyBatisDao.insert(UserDao.class,user);
        }

        List<UserMoney> moneys = userMoneyDao.findByUserId(user.getId());

        if(!StringUtil.isNotEmpty(moneys)) {
            UserMoney money = new UserMoney();
            money.setId(UUIDFactory.random());
            money.setUserId(user.getId());
            money.setUserName(user.getNickName());
            money.setCash("0");
            money.setBonus("0");
            money.setFrozenAmount("0");
            money.setTotalAmount("0");
            this.baseMyBatisDao.insert(UserMoneyDao.class, money);
        }
        return user;
    }

    private String getMemberAccount(){
        String account = StringUtil.getRandom(8);
        List<User> list = this.userDao.findByAccount(account);
        if(StringUtil.isNotEmpty(list)){
            return getMemberAccount();
        }else{
            return account;
        }
    }

  /*  private Member createMember(String parent, String openId, WeiXinUser weiXinUser) throws IOException {
        Member member = new Member();
        member.setAccount(createWxAccount());
        member.setParent(parent);
        member.setLoginPass("888888");
        member.setOpenId(openId);
        if(weiXinUser != null) {
            member.setNick(weiXinUser.getNickname());
            member.setHeadIcon(weiXinUser.getHeadimgurl());
        }
        if(StringUtil.isNullOrEmpty(member.getNick())) {
            member.setNick("M" + member.getAccount());
        }
        //推荐人给当前注册会员发送红包

        System.out.println("自动注册==openId==" + member.getOpenId());
        member.setId(UUIDFactory.random());
        member.setLoginMd5Pass(MD5Util.MD5Encode(member.getLoginPass(), "utf-8"));
        member.setPayPass(member.getLoginPass());
        member.setPayMd5Pass(member.getLoginMd5Pass());
        member.setRegTime(System.currentTimeMillis());
        member.setStatus(true);
        String shopId = ShopByJWdUtil.findShopId(member.getJingdu(), member.getWeidu(), "COMMON");
        member.setShopId(shopId);
        return member;
    }

    //创建微信会员账号
    private String createWxAccount() {
        long count = memberService.countMember();
        return String.valueOf(count) + StringUtil.getNumRandomCode(6);
    }

    //关注回复
    private void textMsgTypeHfSubscribe(WxSetting weiXinSetting, StringBuffer respContent, TextMessage textMessage) throws Exception {
        BeFocusReply beFocusReply = beFocusReplySupportService.findByShopId(shopId);

        //当没有设置默认关注回复或者设置关注回复为 文本模式  或者 图文id为空
        if (StringUtil.isNullOrEmpty(weiXinSetting.getMrBeFocusReply()) || "1".equals(weiXinSetting.getMrBeFocusReply()) ||
                StringUtil.isNullOrEmpty(beFocusReply.getArticlesId())) {//默认回复文本模式
            if (beFocusReply != null && !StringUtil.isNullOrEmpty(beFocusReply.getContent())) {
                respContent.append(beFocusReply.getContent());
            } else {
                mrNoPpReply(weiXinSetting, keywordReplyList, shopId, respContent, textMessage);
            }
        } else {
            textMessage.setMsgType(WxMesType.news.name());
            List<Articles> articlesList = createArticlesList(beFocusReply.getArticlesId());
            textMessage.setArticlesList(articlesList);
            textMessage.setArticleCount(articlesList.size());
        }
    }

    //如果接受到的消息是文本类型的消息
    private void textMsgTypeHf(TextMessage textMessage, StringBuffer respContent, KeywordReply keywordReply, WxSetting weiXinSetting,
                               String shopId, List<KeywordReply> keywordReplyList) throws Exception {
        if (WxMesType.text.name().equals(keywordReply.getMsgType())) {//如果是文本类型
            //回复文本类型
            textMsgTypeHfByText(respContent, keywordReply, weiXinSetting, keywordReplyList, textMessage, shopId);

        } else if (WxMesType.image.name().equals(keywordReply.getMsgType())) {//如果是图片类型
            //回复图片类型
            textMsgTypeHfByImage(keywordReply, weiXinSetting, keywordReplyList, textMessage, respContent, shopId);

        } else if (WxMesType.news.name().equals(keywordReply.getMsgType())) {//如果是图文类型
            //回复图文消息类型
            textMsgTypeHfByNews(keywordReply, weiXinSetting, keywordReplyList, textMessage, respContent, shopId);

        }
    }

    //回复图文消息类型
    private void textMsgTypeHfByNews(KeywordReply keywordReply, WxSetting weiXinSetting, List<KeywordReply> keywordReplyList,
                                     TextMessage textMessage, StringBuffer respContent, String shopId) throws Exception {
        if (StringUtil.isNullOrEmpty(keywordReply.getArticlesId())) {
            mrNoPpReply(weiXinSetting, keywordReplyList, shopId, respContent, textMessage);
        } else {
            textMessage.setMsgType(WxMesType.news.name());
            List<Articles> articlesList = createArticlesList(keywordReply.getArticlesId());
            textMessage.setArticlesList(articlesList);
            textMessage.setArticleCount(articlesList.size());
        }
    }

    //回复图片类型消息
    private void textMsgTypeHfByImage(KeywordReply keywordReply, WxSetting weiXinSetting, List<KeywordReply> keywordReplyList,
                                      TextMessage textMessage, StringBuffer respContent, String shopId) throws Exception {
        String imagePath = keywordReply.getImagePath();
        if (StringUtil.isNullOrEmpty(imagePath)) {
            mrNoPpReply(weiXinSetting, keywordReplyList, shopId, respContent, textMessage);
        } else {
            String domain = "http://" + ServletActionContext.getRequest().getServerName();
            if(imagePath.indexOf("http://") == -1) {
                imagePath = domain + imagePath;
            }
            //上传图片到微信服务器
            String mediaId = WxSupportUtil.uploadImageToWeiXin(WxMesType.image.name(), weiXinSetting, imagePath);
            if (StringUtil.isNullOrEmpty(mediaId)) {
                mrNoPpReply(weiXinSetting, keywordReplyList, shopId, respContent, textMessage);
            } else {
                //给对方发送图片信息
                textMessage.setMediaId(mediaId);
                textMessage.setMsgType(WxMesType.image.name());
            }
        }
    }

    //回复文本类型
    private void textMsgTypeHfByText(StringBuffer respContent, KeywordReply keywordReply, WxSetting weiXinSetting,
                                     List<KeywordReply> keywordReplyList, TextMessage textMessage, String shopId) throws Exception {
        respContent.append(keywordReply.getContent());
        if (StringUtil.isNullOrEmpty(respContent.toString())) {
            mrNoPpReply(weiXinSetting, keywordReplyList, shopId, respContent, textMessage);
        }
    }

    //通过查找回复信息为空的时候  则进行查找自动回复内容  如果开启了默认无匹配关键词回复 则搜索关键词回复内容
    private void mrNoPpReply(WxSetting wxSetting, List<KeywordReply> keywordReplyList, String shopId, StringBuffer respContent,
                             TextMessage textMessage) throws Exception {
        if(!checkMrNoPpReply(wxSetting)) {
            return;
        }
        KeywordReply autoReplyKeyword = createMrNoPpReply(keywordReplyList, wxSetting);
        if (autoReplyKeyword != null) {
            textMsgTypeHf(textMessage, respContent, autoReplyKeyword, wxSetting, shopId, keywordReplyList);
        }
    }


    //根据点击按钮的key值来查找对应的内容
    private void createContentByKey(String eventKey, TextMessage textMessage,
                                    String shopId, StringBuffer respContent) throws Exception {
        List<MenuEvent> menuEventList = menuEventSupportService.listByShopId(shopId);
        if (menuEventList == null || menuEventList.isEmpty()) {
            return;
        }
        for (MenuEvent menuEvent : menuEventList) {
            if (StringUtil.isNullOrEmpty(eventKey)) {
                continue;
            }
            if (!eventKey.equals(menuEvent.getKey())) {
                continue;
            }
            if(WxMesType.text.name().equals(menuEvent.getType())) {
                respContent.append(menuEvent.getContent());
            } else if(WxMesType.news.name().equals(menuEvent.getType())) {
                //根据图文id查找图文
                textMessage.setMsgType(WxMesType.news.name());
                List<Articles> articlesList = createArticlesList(menuEvent.getArticlesId());
                textMessage.setArticlesList(articlesList);
                textMessage.setArticleCount(articlesList.size());
            }
        }
    }

    //组装图文消息 根据图文id查找图文以及该图文消息中关联的多条图文消息
    private List<Articles> createArticlesList(String articlesId) {
        Articles articles = articlesSupportService.findById(articlesId);
        if (articles == null) {
            return null;
        }
        List<Articles> articlesList = articlesSupportService.listByIds(articles.getArticlesIds());
        if (articlesList == null || articlesList.isEmpty()) {
            articlesList = new ArrayList<Articles>();
            articlesList.add(articles);
        } else {
            articlesList.add(0, articles);
        }
        return articlesList;
    }

    //判断关键字表中是否拥有收到的文本消息，如果有责把关键词对应的内容发给你对方，如果没有则发送准备好的内容
    private KeywordReply createContentByKeyword(List<KeywordReply> keywordReplyList, String content) {
        if (keywordReplyList.isEmpty()) {
            return null;
        }
        content = StringUtil.isNullOrEmpty(content) ? "" : content.trim();
        for (KeywordReply keywordReply : keywordReplyList) {
            if (!StringUtil.isNullOrEmpty(keywordReply.getKeyword())) {
                String[] temp = keywordReply.getKeyword().split("\\|");
                for (int i = 0; i < temp.length; i++) {
                    if (content.contains(temp[i])) {
                        return keywordReply;
                    }
                }
            }
        }
        return null;
    }

    //检查是否开启默认无匹配回复 或者开启并且填写了默认无匹配回复关键词内容
    private boolean checkMrNoPpReply(WxSetting weiXinSetting) {
        //如果没有开启默认无匹配回复或者默认无匹配回复关键词内容为空 则直接返回false
        if (!weiXinSetting.isKqMrNoPpReply()) {
            return false;
        }
        if(weiXinSetting.isKqMrNoPpReply() && StringUtil.isNullOrEmpty(weiXinSetting.getMrNoPpReply())) {
            return false;
        }
        return true;
    }

    //根据默认无匹配回复关键词查找 对应的关键词
    private KeywordReply createMrNoPpReply(List<KeywordReply> keywordReplyList, WxSetting weiXinSetting) {
        if (checkMrNoPpReply(weiXinSetting)) {
            String mrNoPpReply = weiXinSetting.getMrNoPpReply();
            KeywordReply keywordReply = createContentByKeyword(keywordReplyList, mrNoPpReply);
            return keywordReply;
        }
        return null;
    }*/


}
